#! /usr/bin/python3

import os, sys

home = os.path.dirname(__file__)
if not home:
    home=os.getcwd()

sys.path.append(home + "/../..")
sys.path.append(home)
sys.path.insert(0, home + '/../../ext_lib')

os.environ.setdefault("DJANGO_SETTINGS_MODULE", 'settings_app')

from django.core.wsgi import get_wsgi_application

application = get_wsgi_application()

if __name__ == '__main__': 
    import cherrypy
    from cherrypy.process.plugins import Daemonizer

    Daemonizer(cherrypy.engine).subscribe()

    cherrypy.tree.mount(application, "/")
    cherrypy.engine.start()
    cherrypy.engine.block()
